package cn.edu.ctbu.datajpa3.repository;

import cn.edu.ctbu.datajpa3.entity.Student;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

public interface StudentRepository extends JpaRepository<Student, Integer> {

    // 按照姓名进行模糊查询，支持分页
    Page<Student> findByNameContaining(String name, Pageable pageable);

    // 按照学号进行模糊查询，支持分页
    Page<Student> findByStudentNumberContaining(String studentNumber, Pageable pageable);

    // 按照姓名或学号进行模糊查询，支持分页
    Page<Student> findByNameContainingOrStudentNumberContaining(String name, String studentNumber, Pageable pageable);
}